package khleuven.mondzorg.db.readers;

import android.content.Context;
import khleuven.mondzorg.db.DBException;

public class EntryBuilderFactory {

	public EntryBuilderFactory() {
	}
	
	public static EntryBuilder createEntryBuilderAndLoad(EntryBuilderType type) throws DBException{
		EntryBuilder builder = null;
		switch (type) {
		case ONLINE:
			throw new DBException("EntryBuilderFactory", "createEntryBuilderAndLoad", "Online Entrybuilder needs the application context", null);
		case OFFLINE:
			builder = new EntryBuilderOffline();
			break;
		case HARDCODED:
			builder = new EntryBuilderHardCoded();
			break;
		default:
			break;
		}
		return builder;
	}

	public static EntryBuilder createEntryBuilderAndLoad(Context applicationContext, EntryBuilderType type) throws DBException {
		EntryBuilder builder = null;
		switch (type) {
		case ONLINE:
			builder = new EntryBuilderOnline(applicationContext);
			break;
		default:
			builder = createEntryBuilderAndLoad(type);
			break;
		}
		return builder;
	}

}
